package com.ten.jinxiancun.controller;

import com.ten.jinxiancun.server.impl.depotServerImpl;
import com.ten.jinxiancun.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;
/*
* 仓库信息控制层
* */
@RestController
@RequestMapping("/depot")
public class depotController {
    @Autowired
    depotServerImpl d;
    @RequestMapping("/gatAllDepot")
    public Object gatAllDepot(@RequestParam Map<String,Object>map,@RequestParam Integer limit,@RequestParam Integer page){
        map.put("limit",limit);
        map.put("page",(page-1)*limit);
        Result res= new Result("0","true",d.depotCountFind(map),d.gatAllDepotFind(map));
        return res;
    }
    @RequestMapping("/depotadd")
    public Object depotadd(@RequestParam Map<String,Object>map){
        Result res= new Result("0","true",d.depotaddFind(map),true);
        return res;
    }
    @RequestMapping("/depotUpdate")
    public Object depotUpadte(@RequestParam Map<String,Object>map){
        Result res = new Result("0","ture",d.depotupdateFind(map),"ture");
        return res;
    }
    @RequestMapping("/depotdel")
    public Object depotdel(@RequestParam("id") Integer id){
        Result res = new Result("0","ture",d.depotdleFind(id),"ture");
        return res;
    }
}
